<template>
  <div class="customService" style="height:auto;">
    <top-bar :title="'客服'"/>
    <iframe id='custom-iframe' :src="url" style="width:100%;height:1000px;"></iframe>
  </div>
</template>

<script>
import topBar from './topBar'

export default {
  name: 'customService',
  components: {
    topBar
  },
  data () {
    return {
      customUrl: ''
    }
  },
  mounted () {
    /**
     * iframe-宽高自适应显示
     */
    const oIframe = document.getElementById('custom-iframe')
    const deviceHeight = document.documentElement.clientHeight
    oIframe.style.height = (Number(deviceHeight) - 120) + 'px' //数字是页面布局高度差
  },
  computed: {
    url () {
      console.log(this.customUrl)
      return this.customUrl
    }
  },
  created () {
    let that = this
    ysf('config', {
      uid: this.$store.state.userDetail.mem_id,      // 用户Id
      name: this.$store.state.userDetail.nickname,          // 用户名称
      email: this.$store.state.userDetail.mem_id, // 用户邮箱
      mobile: this.$store.state.userDetail.email,  // 用户电话
      level: 1, // vip级别
      success: function () {
        window.huo.outWeb(JSON.stringify({url: ysf('url')}))
        //that.customUrl = ysf('url')
      },
      error: function () {
      }
    })
  },
  methods: {}
}
</script>
<style lang="scss" scoped>
.customService {
  padding: 0.75rem 0;

  /deep/ .title {
    padding: 0 0.48rem;
    margin-bottom: 0.48rem;
  }
}
</style>
